#! /bin/python3
# MongoDB ObjectId形式的字符串 转整形

import sys
i = sys.argv[1]

if not i:
    exit(1)

PRE = 'objectid('
if i.lower().startswith(PRE):
    i = i[len(PRE):-1]

if not i.startswith('0x'):
    i = '0x%s' % i

i = int(i, 16)
print(i)
